package com.jxpanda.spring.module.auth.config.properties;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

@Getter
@Setter
@ConfigurationProperties("panda.spring.auth.token")
public class TokenProperties {

    private static final int DEFAULT_EXPIRATION = 7200;

    private final AccessToken access = new AccessToken();

    private final RefreshToken refresh = new RefreshToken();


    @Getter
    @Setter
    @NoArgsConstructor
    @AllArgsConstructor
    public static class AccessToken {

        private TokenMode mode = TokenMode.JWT;

        private int expiresIn = DEFAULT_EXPIRATION;

    }

    @Getter
    @Setter
    @NoArgsConstructor
    @AllArgsConstructor
    public static class RefreshToken {

        private TokenMode mode = TokenMode.OPAQUE;

        private int expiresIn = DEFAULT_EXPIRATION;

        private boolean enable = false;

    }

}
